package com.haoshuang.zhouzhoubang.ui.adapter

import com.haoshuang.zhouzhoubang.databinding.ItemAppointMemberBinding
import com.haoshuang.zhouzhoubang.model.bean.TeamMemberBean
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter
import com.mufeng.libs.utils.view.flexbox
import com.mufeng.libs.utils.view.load
import com.mufeng.libs.utils.view.visibleOrGone

/**
 *
 */
class AppointMemberAdapter(data: MutableList<TeamMemberBean.TeamMemberData>) :
    BaseBindingQuickAdapter<TeamMemberBean.TeamMemberData, ItemAppointMemberBinding>(data) {

    override fun onBindViewHolder(
        holder: BaseBindingHolder,
        position: Int,
        item: TeamMemberBean.TeamMemberData?
    ) {
        holder.getViewBinding<ItemAppointMemberBinding>().apply {

            val adapter = AppointMemberSkillLabelAdapter(item?.skill_name?.toMutableList() ?: mutableListOf())
            recyclerView.flexbox().adapter = adapter

            ivChooseCheck.isSelected = item?.isChoose == true
            rivHead.load(item?.avatar)
            tvName.text = item?.nickname
            tvServiceIng.visibleOrGone(item?.work_status != 0)
            tvServiceEnd.visibleOrGone(item?.work_status == 0)
            tvRest.visibleOrGone(item?.work_rest == "1")

        }
    }

}
